package Reflex.静态方法;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class StaticMethodDemo {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Class stuClass = Class.forName("Reflex.类.Student");
        //静态方法属于类的方法，不需要实例化类
        Method stuMethod = stuClass.getMethod("setCount",int.class);
        //援引
        int invokeMethod = (int)stuMethod.invoke(null,2);
        System.out.println(invokeMethod);
    }
}
